package com.wey.springboot.util;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import java.util.List;
import java.util.Map;

//@Service
public abstract class BaseService<M extends BaseMapper<T>, T> extends ServiceImpl<M, T> {
  protected abstract BaseMapper getMapper();

  public List<Map<String, Object>> listMaps(Map<String, Object> map) {
    QueryWrapper<T> queryWrapper = new QueryWrapper<>();
    map.forEach((k, v) -> {
      queryWrapper.eq(StringUtil.toUnderLine(k), v);
    });
    return listMaps(queryWrapper);
  }
}
